package com.nofeng.wx.utils;

import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.collect.Lists;
import com.nofeng.wx.controller.stock.view.StockReportMinuteRsiView;

import java.util.List;
import java.util.concurrent.TimeUnit;

public class GuavaCacheUtils {

    public static Cache<String, String> localCache = CacheBuilder.newBuilder()
            .build();
    public static Cache<String, String> cache = CacheBuilder.newBuilder()
            .expireAfterWrite(3L, TimeUnit.MINUTES)  //写入5分钟后过期
            .build();

    public static String get(String key) {
        return cache.getIfPresent(key);
    }

    public static void put(String key, String value) {
        cache.put(key, value);
    }

    public static String getLocal(String key) {
        return cache.getIfPresent(key);
    }

    public static void putLocal(String key, String value) {
        cache.put(key, value);
    }

    public static List<StockReportMinuteRsiView> todayOptionList= Lists.newArrayList();
    public static List<String> nbList= Lists.newArrayList();
}
